<?php defined('InShopNC') or exit('Access Invalid!'); ?>
<!--新人福利模块-->
<script type="text/javascript">
    var SHOP_SITE_URL = "<?php echo SHOP_SITE_URL; ?>";
    var UPLOAD_SITE_URL = "<?php echo UPLOAD_SITE_URL; ?>";
    var ATTACH_ADV = "<?php echo ATTACH_ADV; ?>";
    var screen_adv_list = new Array();//焦点大图广告数据
    var screen_adv_append = '';
    var focus_adv_list = new Array();//三张联动区广告数据
    var focus_adv_append = '';
    var adv_info = new Array();
    var ap_id = 0;
    <?php if(!empty($output['screen_adv_list']) && is_array($output['screen_adv_list'])){ ?>
    <?php foreach ($output['screen_adv_list'] as $key => $val) { ?>
    adv_info = new Array();
    ap_id = "<?php echo $val['ap_id'];?>";
    adv_info['ap_id'] = ap_id;
    adv_info['ap_name'] = "<?php echo $val['ap_name'];?>";
    adv_info['ap_img'] = "<?php echo $val['default_content'];?>";
    screen_adv_list[ap_id] = adv_info;
    screen_adv_append += '<option value="'+ap_id+'">'+adv_info['ap_name']+'</option>';
    <?php } ?>
    <?php } ?>
    var important_sale_goods_max = 4;
</script>
<style>
    .sale-layout dl dd ul {
        width: 602px;
    }
    .sale-layout dl dd ul li{
        width:109px;
    }
    .home-templates-board-layout {
        background: none;
        padding-top:0;
        width:630px;
    }
    .home-templates-board-layout dd.act-pic .picture {
        /*width: auto;*/
        height: auto;
    }
    .home-templates-board-layout dd.act-pic .picture img {
        max-width: 900px;
        max-height: 280px;
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back" href="index.php?act=web_config&op=new_web_config" title="返回<?php echo '板块区'; ?>列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3><?php echo $lang['web_config_index']; ?> - <?php echo $lang['web_config_web_edit']; ?>
                    “<?php echo $output['web_array']['web_name'] ?>”板块</h3>
                <h5><?php echo $lang['nc_web_index_subhead']; ?></h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
            <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span> </div>
        <ul>
            <li><?php echo $lang['web_config_edit_help1'];?></li>
        </ul>
    </div>
    <div class="homepage-focus" id="homepageFocusTab">
        <div class="title">
            <h3>“<?php echo $output['web_array']['web_name'] ?>”区域设置</h3>
        </div>

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">图片区布局块预览</dt>
                <dd class="opt">
                    <div class="home-templates-board-layout style-<?php echo $output['web_array']['style_name'];?>">
                        <dl>
                            <dt>
                                <h4><?php echo $output['code_act']['code_info']['title'];?></h4>
                                <a href="JavaScript:show_dialog('upload_act');"><i class="fa fa-picture-o"></i><?php echo $lang['nc_edit'];?></a>
                            </dt>
                            <dd class="act-pic">
                                <div id="picture_act" class="picture">
                                    <?php if(!empty($output['code_act']['code_info']['pic'])) { ?>
                                        <img src="<?php echo UPLOAD_SITE_URL.'/'.$output['code_act']['code_info']['pic'];?>"/>
                                    <?php } ?>
                                </div>
                            </dd>
                        </dl>
                    </div>
                </dd>
            </dl>
        </div>
        <form id="sale_list_form" method="post" name="form1">
            <input type="hidden" name="web_id" value="<?php echo $output['code_sale_list']['web_id'];?>">
            <input type="hidden" name="code_id" value="<?php echo $output['code_sale_list']['code_id'];?>">
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">商品区布局块预览</dt>
                    <dd class="opt sale-layout">
<!--                        --><?php //if (is_array($output['code_sale_list']['code_info']) && !empty($output['code_sale_list']['code_info'])) { ?>
<!--                            --><?php //foreach ($output['code_sale_list']['code_info'] as $key => $val) { ?>
                                <dl sale_id="<?php echo 0;?>">
                                    <dt class="title">
                                        <h4><?php echo $output['code_sale_list']['code_info'][0]['recommend']['name'];?></h4>
                                        <input name="sale_list[<?php echo 0;?>][recommend][name]" value="<?php echo $output['code_sale_list']['code_info'][0]['recommend']['name'];?>" type="hidden">
                                        <a href="JavaScript:show_sale_dialog(<?php echo 0;?>);" class="ncap-btn-mini edit"><i class="fa fa-pencil-square-o"></i><?php echo $lang['nc_edit'];?></a> </dt>
                                    <dd>
                                        <ul>
                                            <?php if(!empty($output['code_sale_list']['code_info'][0]['goods_list']) && is_array($output['code_sale_list']['code_info'][0]['goods_list'])){ ?>
                                                <?php foreach($output['code_sale_list']['code_info'][0]['goods_list'] as $k => $v){ ?>
                                                    <li>
                                                        <div class="goods-thumb"><img title="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"/></div>
                                                        <input name="sale_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_id]" value="<?php echo $v['goods_id'];?>" type="hidden">
                                                        <input name="sale_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][market_price]" value="<?php echo $v['market_price'];?>" type="hidden">
                                                        <input name="sale_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_name]" value="<?php echo $v['goods_name'];?>" type="hidden">
                                                        <input name="sale_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_price]" value="<?php echo $v['goods_price'];?>" type="hidden">
                                                        <input name="sale_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_pic]" value="<?php echo $v['goods_pic'];?>" type="hidden">
                                                    </li>
                                                <?php } ?>
                                            <?php } ?>
                                        </ul>
                                    </dd>
                                </dl>
<!--                            --><?php //} ?>
<!--                        --><?php //} ?>
                        <div class="clear" id="add_list"></div>
<!--                        <div class="add-sale"><a class="ncap-btn" href="JavaScript:add_sale_list();">--><?php //echo $lang['web_config_add_recommend'];?><!--</a>--><?php //echo $lang['web_config_sale_max'];?><!--</div>-->
                    </dd>
                </dl>
            </div>
        </form>


        <div class="ncap-form-default">
            <div class="bot">
                <a href="index.php?act=web_config&op=html_update&web_id=<?php echo $_GET['web_id'];?>" class="ncap-btn-big ncap-btn-green"><?php echo $lang['web_config_web_html']; ?></a>
            </div>
        </div>

    </div>
</div>

<!-- 活动图片 -->
<div id="upload_act_dialog" class="upload_act_dialog" style="display:none;">
    <div class="s-tips"><i class="fa fa-lightbulb-o"></i><?php echo $lang['web_config_prompt_act'];?></div>
    <form id="upload_act_form" name="upload_act_form" enctype="multipart/form-data" method="post" action="index.php?act=web_config&op=upload_pic" target="upload_pic">
        <input type="hidden" name="form_submit" value="ok" />
        <input type="hidden" name="web_id" value="<?php echo $output['code_act']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_act']['code_id'];?>">
        <input type="hidden" name="act[pic]" value="<?php echo $output['code_act']['code_info']['pic'];?>">
        <input type="hidden" name="act[type]" value="pic">
        <div class="ncap-form-default" id="upload_act_type_pic" <?php if($output['code_act']['code_info']['type'] == 'adv') { ?>style="display:none;"<?php } ?>>
            <dl class="row">
                <dt class="tit"><?php echo '活动名称';?></dt>
                <dd class="opt">
                    <input class="input-txt" type="text" name="act[title]" value="<?php echo $output['code_act']['code_info']['title'];?>">
                    <p class="notic"><?php echo '';?></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_url'].$lang['nc_colon'];?></label>
                </dt>
                <dd class="opt">
                    <input name="act[url]" value="<?php echo !empty($output['code_act']['code_info']['url']) ? $output['code_act']['code_info']['url']:SHOP_SITE_URL;?>" class="input-txt" type="text">
                    <p class="notic"><?php echo $lang['web_config_upload_act_url'];?></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_act'];?></label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show"><span class="type-file-box">
            <input type='text' name='textfield' id='textfield1' class='type-file-text' />
            <input type='button' name='button' id='button1' value='选择上传...' class='type-file-button' />
            <input name="pic" id="pic" type="file" class="type-file-file" size="30">
            </span></div>
                    <p class="notic"><?php echo $lang['web_config_upload_act_tips'];?></p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="$('#upload_act_form').submit();" class="ncap-btn-big ncap-btn-green"><?php echo $lang['nc_submit'];?></a></div>
        </div>
    </form>
</div>

<!-- 促销区商品推荐模块 -->

<div id="sale_list_dialog" style="display:none;">
    <div class="s-tips"><i></i>小提示：单击查询出的商品选中，双击已选择的可以删除，最多4个，保存后生效。</div>
<!--    --><?php //if (is_array($output['code_sale_list']['code_info']) && !empty($output['code_sale_list']['code_info'])) { ?>
<!--        --><?php //foreach ($output['code_sale_list']['code_info'] as $key => $val) { ?>
            <!--<div class="ncap-form-default" select_sale_id="<?php /*echo $key;*/?>">
                <dl class="row">
                    <dt class="tit"><?php /*echo $lang['web_config_recommend_title'];*/?></dt>
                    <dd class="opt">
                        <input name="sale_list[<?php /*echo $key;*/?>][recommend][name]" value="<?php /*echo $val['recommend']['name'];*/?>" type="text" class="w200">
                        <p class="notic"><?php /*echo $lang['web_config_recommend_tips'];*/?></p>
                    </dd>
                </dl>
            </div>-->
            <div class="ncap-form-all" select_sale_id="<?php echo 0;?>">
                <dl class="row">
                    <dt class="tit">已选商品</dt>
                    <dd class="opt">
                        <ul class="dialog-goodslist-s1 goods-list">
                            <?php if(!empty($output['code_sale_list']['code_info'][0]['goods_list']) && is_array($output['code_sale_list']['code_info'][0]['goods_list'])){ ?>
                                <?php foreach($output['code_sale_list']['code_info'][0]['goods_list'] as $k => $v){ ?>
                                    <li>
                                        <div ondblclick="del_sale_goods(<?php echo $v['goods_id'];?>);" class="goods-pic">
                                            <span class="ac-ico" onclick="del_sale_goods(<?php echo $v['goods_id'];?>);"></span>
                                            <span class="thumb size-72x72"><i></i><img select_goods_id="<?php echo $v['goods_id'];?>"
                                                   title="<?php echo $v['goods_name'];?>" goods_name="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"
                                                   onload="javascript:DrawImage(this,72,72);" goods_price="<?php echo $v['goods_price'];?>" market_price="<?php echo $v['goods_marketprice'];?>" /></span>
                                        </div>
                                        <div class="goods-name"><a href="<?php echo SHOP_SITE_URL."/index.php?act=goods&goods_id=".$v['goods_id'];?>" target="_blank"><?php echo $v['goods_name'];?></a></div>
                                    </li>
                                <?php } ?>
                            <?php } ?>
                        </ul>
                    </dd>
                </dl>
            </div>
<!--        --><?php //} ?>
<!--    --><?php //} ?>
    <div id="select_sale_list" style="display:none;"></div>
    <div class="ncap-form-all">
        <dl class="row">
            <dt class="tit">选择要展示的商品</dt>
            <dd class="opt">
                <div class="search-bar" id="gcategory">
                    <label>排序
                        <select name="goods_order" id="goods_order">
                            <option value="goods_salenum" selected><?php echo $lang['web_config_goods_order_sale'];?></option>
                            <option value="goods_click" ><?php echo $lang['web_config_goods_order_click'];?></option>
                            <option value="evaluation_count" ><?php echo $lang['web_config_goods_order_comment'];?></option>
                            <option value="goods_collect" ><?php echo $lang['web_config_goods_order_collect'];?></option>
                        </select>
                    </label>
                    分类
                    <input type="hidden" id="cate_id" name="cate_id" value="0" class="mls_id" />
                    <input type="hidden" id="cate_name" name="cate_name" value="" class="mls_names" />
                    <select>
                        <option value="0"><?php echo $lang['nc_please_choose'];?></option>
                        <?php if(!empty($output['goods_class']) && is_array($output['goods_class'])){ ?>
                            <?php foreach($output['goods_class'] as $k => $v){ ?>
                                <option value="<?php echo $v['gc_id'];?>"><?php echo $v['gc_name'];?></option>
                            <?php } ?>
                        <?php } ?>
                    </select>
                    <input type="text" value="" name="order_goods_name" id="order_goods_name" placeholder="输入商品名称或SKU编号" class="txt 150">
                    <a href="JavaScript:void(0);" onclick="get_goods_list();" class="ncap-btn"><?php echo $lang['nc_query'];?></a></div>
            </dd>
        </dl>
        <div id="show_sale_goods_list"></div>
    </div>
    <div class="bot"><a href="JavaScript:void(0);" onclick="update_sale();" class="ncap-btn-big ncap-btn-green"><span><?php echo $lang['web_config_save'];?></span></a></div>
</div>

<iframe style="display:none;" src="" name="upload_pic"></iframe>
<link href="<?php echo RESOURCE_SITE_URL; ?>/js/colorpicker/evol.colorpicker.css" rel="stylesheet" type="text/css">
<script src="<?php echo RESOURCE_SITE_URL; ?>/js/colorpicker/evol.colorpicker.min.js"></script>
<script src="<?php echo RESOURCE_SITE_URL; ?>/js/waypoints.js"></script>
<script src="<?php echo ADMIN_RESOURCE_URL ?>/js/web_focus.js"></script>

<script src="<?php echo ADMIN_RESOURCE_URL; ?>/js/jquery.ajaxContent.pack.js"></script>
<script src="<?php echo RESOURCE_SITE_URL; ?>/js/common_select.js"></script>
<script src="<?php echo ADMIN_RESOURCE_URL ?>/js/web_index.js"></script>